<template>
  <section class="index">
    <div class="hello">
      <i class="iconfont icon-xihuan"></i><span>很高兴遇见你,{{user.userName}}</span>
    </div>
    <div class="msg">
      <p class="title">系统公告：</p>
      <ul>
        <li @click="openMsg()"><i class="iconfont icon-flag"></i>留言功能已开通</li>
        <li @click="openMsg2()"><i class="iconfont icon-flag"></i>试题难度一下降</li>
        <li @click="openMsg3()"><i class="iconfont icon-flag"></i>测试1</li>
        <li @click="openMsg3()"><i class="iconfont icon-flag"></i>测试2</li>
        <li @click="openMsg3()"><i class="iconfont icon-flag"></i>测试3</li>
      </ul>
    </div>
  </section>
</template>

<script>
export default {
  data() {
    return {
      user: { //用户信息
        userName: null,
        userId: null
      }
    }
  },
  created() {
    this.getUserInfo()
  },
  methods: {
    getUserInfo() { //获取用户信息
      let userName = this.$cookies.get("cname")
      let userId = this.$cookies.get("cid")
      this.user.userName = userName
      this.user.userId = userId
    },
    openMsg() {
      this.$alert('留言功能已开通，请管理员认真查看用户对本系统的留言','留言功能已开通',{
        confirmButtonText: '确定'
      })
    },
    openMsg2() {
      this.$alert('试题难度下降','试题难度下降',{
        confirmButtonText: '确定'
      })
    },
    openMsg3() {
      this.$alert('测试','测试',{
        confirmButtonText: '确定'
      })
    },
  }
}
</script>


<style lang="scss" scoped>
.index {
  margin-left: 70px;
  .hello {
    font-size: 20px;
    color: #726f70;
    .icon-xihuan {
      font-size: 30px;
      color: #dd6572;
    }
  }
  .msg {
    .title {
      font-size: 16px;
      color: #000;
      margin-top: 20px;
      margin-left: 10px;
    }
    ul {
      display: flex;
      flex-direction: column;
      width: 200px;
      overflow: hidden;
    }
    li {
      margin-top: 10px;
      font-size: 14px;
      color: lightcoral;
      cursor: pointer;
      display: inline-block;
    }
  }
}
</style>

